# by：李文雄
# 开发时间：2023-03-25 16:13

import os

import pytest

if __name__ == "__main__":
    # 生成JSON数据,加上--clean-alluredir解决JSON文件生成冗余问题
    pytest.main(["-s", "--alluredir=outputs/reports/allure", "--clean-alluredir"])
    # 命令：pytest -v -s --alluredir=outputs/reports/allure --clean-alluredir

    # 将JSON文件转换成HTML格式的测试报告（生成JSON文件路径：outputs/reports/allure; 生成HTML报告路径：outputs/reports/html）
    os.system("allure generate outputs/reports/allure -o outputs/reports/html --clean")
    # 命令：allure generate outputs/reports/allure -o outputs/reports/html --clean
    # 打开测试报告
    os.system("allure serve outputs/reports/allure")
    # 命令：allure serve outputs/reports/allure

